package chapter04;

public class Test05_tranform {
    public static void main(String[] args) {
        //向上转型自动完成
        ComputerTable t = new ComputerTable();
        Table t1 = t;
        t1.info();
        //Table t2 = new Table();
        //ComputerTable t22 = (ComputerTable)t2;
        //向下转型 父类向子类转换 目的取得子类的特有方法
        //和属性
        ComputerTable t11 = (ComputerTable) t1;
        t11.ability();

    }
}
class Table{
    public void info(){
        System.out.println("一个普通的桌子");
    }
}
class ComputerTable extends Table{
    @Override
    public void info() {
        System.out.println("一个电脑桌");
    }
    public void ability(){
        System.out.println("能够升降");
    }
}
